﻿using System;
using System.Windows.Data;
using System.Windows.Media;
using Scrabble.Model;

namespace Scrabble.Controls
{
    public class ScoringStyleToColorConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            var result = Colors.Beige;

            if (value is ScoringStyle)
            {
                var style = (ScoringStyle) value;

                switch (style)
                {
                    case ScoringStyle.LetterOnly:
                        result = Colors.Ivory;
                        break;

                    case ScoringStyle.DoubleLetter:
                        result = Colors.LightBlue;
                        break;

                    case ScoringStyle.TripleLetter:
                        result = Colors.DodgerBlue;
                        break;

                    case ScoringStyle.DoubleWord:
                        result = Colors.Pink;
                        break;

                    case ScoringStyle.TripleWord:
                        result = Colors.Firebrick;
                        break;
                }
            }

            return result.ToString();
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
